
package com.hyst.util;
/**
 * @Description:
 * @Date：2017年6月19日
 * @author： DongY
 * @version ：1.0
 * 	  1.[2017年6月19日]CreatBy：dy
 */

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.PropertySource;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.stereotype.Component;
import org.w3c.dom.ls.LSInput;


@PropertySource("config.properties")
@Component("myConfig")
public class MyConfig implements InitializingBean{
	@Value("${creatTableName:''}")
	private String creatTableName;
	private List<String> creatTableNames=new ArrayList<>();
	@Value("${packageName:'com.hyst.model'}")
	//@Value("com.hyst.com")
	private String packageName;
	@Value("${filedAnnotations:''}")
	private String filedAnnts;
	private List<String> filedAnnotations=new ArrayList<>();
	@Value("${controllerAnns:''}")
	private String controllerAns;
	private List<String> controllerAnns=new ArrayList<>();
	
	@Value("${nameConversion:'hump'}")
	private String nameConversion;
	
	@Value("${serviceAnnotations:''}")
	private String serviceAnns;
	private List<String> serviceAnnotations=new ArrayList<>();
	
	@Value("${controllerImport:''}")
	private String controllerImports;
	private List<String> controllerImport=new ArrayList<>();
	
	@Value("${serviceImport:''}")
	private String serviceImports;
	private List<String> serviceImport=new ArrayList<>();
	@Value("${modelImports:''}")
	private String modelImports;
	private List<String> modelImport=new ArrayList<>();
	
	@Value("${modelAnns:''}")
	private String modelAnns;
	private List<String> modelAnn=new ArrayList<>();
	
	@Value("${preAnno:''}")
	private String preAnno;
	@Value("${changedFiled:''}")
	private String changedFiled;
	/**
	 * 生成文件的保存路径，默认D:\\javaFile下面
	 */
	@Value("${filePath:d:\\javaFile/}")
	private String filePth;
	@Value("${cleaPath:false}")
	private boolean cleaPath;
	@Override
	public void afterPropertiesSet() throws Exception {
		System.out.println("--------------------------"+cleaPath);
		System.out.println(modelImports);
		filedAnnotations=filedAnnts.equals("''")?new ArrayList<String>():Arrays.asList(filedAnnts.split(","));
		controllerAnns=controllerAns.equals("''")?new ArrayList<String>():Arrays.asList(controllerAns.split(","));
		serviceAnnotations=serviceAnns.equals("''")?new ArrayList<String>():Arrays.asList(serviceAnns.split(","));
		controllerImport=controllerImports.equals("''")?new ArrayList<String>():Arrays.asList(controllerImports.split(","));
		serviceImport=serviceImports.equals("''")?new ArrayList<String>():Arrays.asList(serviceImports.split(","));
		modelImport=modelImports.equals("''")?new ArrayList<String>():Arrays.asList(modelImports.split(","));
		modelAnn=modelAnns.equals("''")?new ArrayList<String>():Arrays.asList(modelAnns.split(","));
		creatTableNames=creatTableName.equals("''")?new ArrayList<String>():Arrays.asList(creatTableName.split(","));
		
		System.out.println(modelImport.size());//creatTableNames
	}
	


	/**
	 * @return cleaPath	返回类型：boolean
	 */
	public boolean isCleaPath() {
		return cleaPath;
	}



	/**
	 * @param 参数类型 boolean,cleaPath 要设置的字段 cleaPath
	*/
	public void setCleaPath(boolean cleaPath) {
		this.cleaPath = cleaPath;
	}



	/**
	 * @return creatTableNames	返回类型：List<String>
	 */
	public List<String> getCreatTableNames() {
		return creatTableNames;
	}



	/**
	 * @param 参数类型 List<String>,creatTableNames 要设置的字段 creatTableNames
	*/
	public void setCreatTableNames(List<String> creatTableNames) {
		this.creatTableNames = creatTableNames;
	}



	@Override
	public String toString() {
		return "MyConfig [packageName=" + packageName + ", filedAnnts=" + filedAnnts + ", filedAnnotations="
				+ filedAnnotations + ", controllerAns=" + controllerAns + ", controllerAnns=" + controllerAnns
				+ ", serviceAnns=" + serviceAnns + ", serviceAnnotations=" + serviceAnnotations + ", controllerImports="
				+ controllerImports + ", controllerImport=" + controllerImport + ", serviceImports=" + serviceImports
				+ ", serviceImport=" + serviceImport + ", modelImports=" + modelImports + ", modelImport=" + modelImport
				+ "]";
	}

	private void addArr2List(String[] arr,List<String> list){
		list=Arrays.asList(arr);
	}

	
	/**
	 * @return creatTableName	返回类型：String
	 */
	public String getCreatTableName() {
		return creatTableName;
	}



	/**
	 * @param 参数类型 String,creatTableName 要设置的字段 creatTableName
	*/
	public void setCreatTableName(String creatTableName) {
		this.creatTableName = creatTableName;
	}



	/**
	 * @return modelAnns	返回类型：String
	 */
	public String getModelAnns() {
		return modelAnns;
	}

	/**
	 * @param 参数类型 String,modelAnns 要设置的字段 modelAnns
	*/
	public void setModelAnns(String modelAnns) {
		this.modelAnns = modelAnns;
	}

	/**
	 * @return nameConversion	返回类型：String
	 */
	public String getNameConversion() {
		return nameConversion;
	}



	/**
	 * @param 参数类型 String,nameConversion 要设置的字段 nameConversion
	*/
	public void setNameConversion(String nameConversion) {
		this.nameConversion = nameConversion;
	}



	/**
	 * @return modelAnn	返回类型：List<String>
	 */
	public List<String> getModelAnn() {
		return modelAnn;
	}

	/**
	 * @return preAnno	返回类型：String
	 */
	public String getPreAnno() {
		return preAnno;
	}

	/**
	 * @param 参数类型 String,preAnno 要设置的字段 preAnno
	*/
	public void setPreAnno(String preAnno) {
		this.preAnno = preAnno;
	}

	/**
	 * @return changedFiled	返回类型：String
	 */
	public String getChangedFiled() {
		return changedFiled;
	}

	/**
	 * @param 参数类型 String,changedFiled 要设置的字段 changedFiled
	*/
	public void setChangedFiled(String changedFiled) {
		this.changedFiled = changedFiled;
	}

	/**
	 * @param 参数类型 List<String>,modelAnn 要设置的字段 modelAnn
	*/
	public void setModelAnn(List<String> modelAnn) {
		this.modelAnn = modelAnn;
	}

	/**
	 * @return filePth	返回类型：String
	 */
	public String getFilePth() {
		return filePth;
	}

	/**
	 * @param 参数类型 String,filePth 要设置的字段 filePth
	*/
	public void setFilePth(String filePth) {
		this.filePth = filePth;
	}

	/**
	 * @return packageName	返回类型：String
	 */
	public String getPackageName() {
		return packageName;
	}
	/**
	 * @param 参数类型 String,packageName 要设置的字段 packageName
	*/
	public void setPackageName(String packageName) {
		this.packageName = packageName;
	}
	/**
	 * @return filedAnnts	返回类型：String
	 */
	public String getFiledAnnts() {
		
		return filedAnnts;
	}
	/**
	 * @param 参数类型 String,filedAnnts 要设置的字段 filedAnnts
	*/
	public void setFiledAnnts(String filedAnnts) {
		
		this.filedAnnts = filedAnnts;
	}
	/**
	 * @return filedAnnotations	返回类型：List<String>
	 */
	public List<String> getFiledAnnotations() {
		return filedAnnotations;
	}
	/**
	 * @param 参数类型 List<String>,filedAnnotations 要设置的字段 filedAnnotations
	*/
	public void setFiledAnnotations(List<String> filedAnnotations) {
		System.out.println(filedAnnotations);
		this.filedAnnotations = filedAnnotations;
	}
	/**
	 * @return controllerAns	返回类型：String
	 */
	public String getControllerAns() {
		return controllerAns;
	}
	/**
	 * @param 参数类型 String,controllerAns 要设置的字段 controllerAns
	*/
	public void setControllerAns(String controllerAns) {
		this.controllerAns = controllerAns;
	}
	/**
	 * @return controllerAnns	返回类型：List<String>
	 */
	public List<String> getControllerAnns() {
		return controllerAnns;
	}
	/**
	 * @param 参数类型 List<String>,controllerAnns 要设置的字段 controllerAnns
	*/
	public void setControllerAnns(List<String> controllerAnns) {
		this.controllerAnns = controllerAnns;
	}
	/**
	 * @return serviceAnns	返回类型：String
	 */
	public String getServiceAnns() {
		return serviceAnns;
	}
	/**
	 * @param 参数类型 String,serviceAnns 要设置的字段 serviceAnns
	*/
	public void setServiceAnns(String serviceAnns) {
		this.serviceAnns = serviceAnns;
	}
	/**
	 * @return serviceAnnotations	返回类型：List<String>
	 */
	public List<String> getServiceAnnotations() {
		return serviceAnnotations;
	}
	/**
	 * @param 参数类型 List<String>,serviceAnnotations 要设置的字段 serviceAnnotations
	*/
	public void setServiceAnnotations(List<String> serviceAnnotations) {
		this.serviceAnnotations = serviceAnnotations;
	}
	/**
	 * @return controllerImports	返回类型：String
	 */
	public String getControllerImports() {
		return controllerImports;
	}
	/**
	 * @param 参数类型 String,controllerImports 要设置的字段 controllerImports
	*/
	public void setControllerImports(String controllerImports) {
		this.controllerImports = controllerImports;
	}
	/**
	 * @return controllerImport	返回类型：List<String>
	 */
	public List<String> getControllerImport() {
		return controllerImport;
	}
	/**
	 * @param 参数类型 List<String>,controllerImport 要设置的字段 controllerImport
	*/
	public void setControllerImport(List<String> controllerImport) {
		this.controllerImport = controllerImport;
	}
	/**
	 * @return serviceImports	返回类型：String
	 */
	public String getServiceImports() {
		return serviceImports;
	}
	/**
	 * @param 参数类型 String,serviceImports 要设置的字段 serviceImports
	*/
	public void setServiceImports(String serviceImports) {
		this.serviceImports = serviceImports;
	}
	/**
	 * @return serviceImport	返回类型：List<String>
	 */
	public List<String> getServiceImport() {
		return serviceImport;
	}
	/**
	 * @param 参数类型 List<String>,serviceImport 要设置的字段 serviceImport
	*/
	public void setServiceImport(List<String> serviceImport) {
		this.serviceImport = serviceImport;
	}
	/**
	 * @return modelImports	返回类型：String
	 */
	public String getModelImports() {
		return modelImports;
	}
	/**
	 * @param 参数类型 String,modelImports 要设置的字段 modelImports
	*/
	public void setModelImports(String modelImports) {
		this.modelImports = modelImports;
	}
	/**
	 * @return modelImport	返回类型：List<String>
	 */
	public List<String> getModelImport() {
		return modelImport;
	}
	/**
	 * @param 参数类型 List<String>,modelImport 要设置的字段 modelImport
	*/
	public void setModelImport(List<String> modelImport) {
		this.modelImport = modelImport;
	}



	


	
}
